/**
 * @Author:  renyc
 * @Date: 2022年12月7日23:43:26
 */

 'use strict';

 import ChartLayer from "../ChartLayer";
 import ChartType from "../ChartType";

 
 class RouteLayer extends ChartLayer{
     constructor(name, options){
         super(name, options);
         this._chartType = ChartType.ROUTE;
     }
 
     setData(data){
         if(this._echarts){
             let options = this._buildEChartOptions(data);
             if(options){
                 this._echarts.setOption(options);
             }
         }
     }
 
     _buildEChartOptions(lines){
         if(!lines){
             return;
         }
 
         return {
            animation: false,
			GLMap: {},
            series: [
              {
                type: 'lines',
                coordinateSystem: 'GLMap',
                polyline: true,
                data: lines,
                silent: true,
                lineStyle: {
                  // color: '#c23531',
                  // color: 'rgb(200, 35, 45)',
                  opacity: 0.2,
                  width: 1
                },
                progressiveThreshold: 500,
                progressive: 200
              },
              {
                type: 'lines',
                coordinateSystem: 'GLMap',
                polyline: true,
                data: lines,
                lineStyle: {
                  width: 0
                },
                effect: {
                  constantSpeed: 20,
                  show: true,
                  trailLength: 0.1,
                  symbolSize: 1.5
                },
                zlevel: 1
              }
            ]
          }
     }
 }
 
 export default RouteLayer
 
 /**
  * SampleData
 
  */